package com.snowRemovingUser.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.snowRemovingUser.domain.TOperStatistics;
import com.snowRemovingUser.dto.CurveVo;
import com.snowRemovingUser.service.ITOperStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 操作统计Controller
 *
 * @author liguang
 * @date 2023-04-28
 */
@RestController
@RequestMapping("/snowRemoving/operstatistics")
public class TOperStatisticsController extends BaseController
{
    @Autowired
    private ITOperStatisticsService tOperStatisticsService;

    /**
     * 查询操作统计列表
     */
    @PreAuthorize("@ss.hasPermi('snowRemoving:operstatistics:list')")
    @GetMapping("/list")
    public TableDataInfo list(TOperStatistics tOperStatistics)
    {
        startPage();
        List<TOperStatistics> list = tOperStatisticsService.selectTOperStatisticsList(tOperStatistics);
        return getDataTable(list);
    }

    /**
     * 导出操作统计列表
     */
    @PreAuthorize("@ss.hasPermi('snowRemoving:operstatistics:export')")
    @Log(title = "操作统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TOperStatistics tOperStatistics)
    {
        List<TOperStatistics> list = tOperStatisticsService.selectTOperStatisticsList(tOperStatistics);
        ExcelUtil<TOperStatistics> util = new ExcelUtil<TOperStatistics>(TOperStatistics.class);
        util.exportExcel(response, list, "操作统计数据");
    }


    /**
     * 查询曲线数据
     */
    @PreAuthorize("@ss.hasPermi('snowRemoving:operstatistics:list')")
    @GetMapping("/curveData")
    public CurveVo curveData(TOperStatistics tOperStatistics) {

        return tOperStatisticsService.selectTOperCurve(tOperStatistics);

    }








}
